package com.zryc.shop.ums.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.zryc.shop.ums.entity.Admin;
import com.zryc.shop.ums.entity.Resource;
import com.zryc.shop.ums.entity.ResourceCategory;
import com.zryc.shop.ums.mapper.ResourceCategoryMapper;
import com.zryc.shop.ums.service.IResourceCategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 资源分类表 服务实现类
 * </p>
 *
 * @author zhaozhao
 * @since 2024-01-16
 */
@Service
public class ResourceCategoryServiceImpl extends ServiceImpl<ResourceCategoryMapper, ResourceCategory> implements IResourceCategoryService {


    /**
     * 更新资源模块信息
     * @param id
     * @param resourceCategory
     * @return
     */
    @Override
    public Object updaterResourceCategory(Long id, ResourceCategory resourceCategory) {
        UpdateWrapper<ResourceCategory> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id",id);
        baseMapper.update(resourceCategory,updateWrapper);
        return null;
    }

    /**
     * 删除资源模块以及资源
     * @param id
     * @return
     */
    @Override
    public Object deleteById(Long id) {
        baseMapper.deleteById(id);
        baseMapper.deleteResourceById(id);
        return "删除成功";
    }
}
